package com.zzw.basic.classloader;

import java.lang.reflect.Field;

public class Person {

	private String name;
	private int age;
	
	@Override
	public String toString() {
		return "Person[name:" + name
				+ " ,age:" + age + "]";
	}
	
	public static void main(String[] args) throws Exception, SecurityException {
		Person p = new Person();
		Class<Person> personClazz = Person.class;
		Field nameFiled = personClazz.getDeclaredField("name");
		nameFiled.setAccessible(true);
		nameFiled.set(p, "Yeeku.H.Lee");
		Field ageField = personClazz.getDeclaredField("age");
		ageField.setAccessible(true);
		ageField.setInt(p, 30);
		System.out.println(p);
	}
}
